

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <title>
  ObjectDB for Java/JDO Demo - JDO Directory - A Brief JDO Tutorial
  </title>
  <style type='text/css'>
body {
    font-family: Arial, Verdana, sans-serif;
}
     
body, .background {
    background: #ffffff;
}
h1 {
    font-size: 16pt; letter-spacing: 0pt;
    line-height: 30px;
    margin-top: 12px; margin-bottom: 8px;
    padding: 3px; padding-left: 4px;
    background-color: #7b9cc6; color: #ffffff;
    border-style: solid; border-width: 1px; border-color: #336699;
}
h2 {
    font-size: 13pt; letter-spacing: 0pt;
    line-height: 24px;
    margin-top: 24px; margin-bottom: 4px; padding-left: 4px;
    background-color: #666699; color: #ffffff;
}
h3 {
    font-size: 12pt; text-decoration: none; font-weight: bold;
    margin-top: 24px; margin-bottom: 4px; padding-bottom: 0px;
}

h4 {
    font-size: 10pt; text-decoration: none; font-weight: bold;
    margin-top: 24px; margin-bottom: 4px; padding-bottom: 0px;
}

ul {
    margin-top: 0px; margin-bottom: 12px;
    padding-top: 0px; padding-bottom: 0px; 
    line-height: 100%;
}
p {
		text-align: justify; margin-top: 8px; margin-bottom: 16px;
}
p, li {
    font-size: 11pt; line-height: 140%; 
}
li {
    margin-right: 20px;
}
td {
    font-size: 11pt; line-height: 100%; 
}
td.small {
    padding-top: 0px; padding-bottom: 0px;
    line-height: 90%;  font-size: 10pt;
}
.frame {
    background: #666699;
}
.center {
    background: #ffffff;
}
.center2 {
    padding: 2px; text-align: left; font-weight: normal;
    background: #ffffff; color: #000000;
    line-height: 90%;  font-size: 10pt;
}
.tableHeader {
    background: #AAAADD; color: #000000;
}
.topMenu {
    color: #ffffff; font-size: 12px; text-decoration: none; font-weight: bold;
}
.topMenu:hover {
    color: #ffff00;
}
.topMenuSep {
    color: #336699; font-size: 12px; font-weight: 900; padding: 2px; 
}
.leftMenu {
    color: #FFFFFF;
    font-size: 13px; text-decoration: none; font-weight: 900;
    padding-left: 8px; line-height: 20px;
}
.leftMenu:hover {
    color: #FFFF00;
}
.headBox {
    background-color: #7b9cc6; color: #ffffff; border-color: #336699;
    font-family: Verdana, 'Lucida Sans', Arial, Geneva, sans-serif; 
    font-weight: bold; text-decoration: none; font-size: 10pt;
    border-style: solid; border-width: 1px; padding: 4px;
    display: block; text-align: left; text-decoration: none;
} 
.dynaContent {
    padding: 2px; text-align: left; font-size: 10pt; font-weight: normal;
    line-height: 110%;
} 

.footer, smallerFont {
    font-size: 12px; color: #ffffff;
}
code, pre {
	font-size: 10pt;
}
pre {
	background: #e0e0e0; line-height: 130%; padding: 4px;
	margin-top: 4px; margin-bottom: 18px;
  margin-left: 12px; margin-right: 8px;
}
</style>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">


<link rel="shortcut icon" href="http://www.objectdb.com/favicon.ico"> 
</head>

<body><div align='center'><table width='100%'><tr><td>

<table width='100%' cellspacing='0' cellpadding='0'><tr>
<td>
    <h1>ObjectDB for Java/JDO Demo
    <br>The JDO Directory - A Brief Tutorial</h1>
</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td width='150'>
    <img src='images/jdo-dir-logo.gif' width='192' height='105'
           alt='JDO Directory'>
</td>
</tr></table>

<h2>Introduction</h2>

<p>
The <b>JDO Directory</b> demo shows how to use ObjectDB and JDO to manage
a hierarchical directory of links, like Google Directory or Yahoo Directory.
The demo consists of four steps, each of them is a separate program.
Steps 1-3 are console programs and step 4, whose screenshot is shown below,
is a GUI program.
Step 1 shows how to create a database file and how to store objects using JDO.
Step 2 shows how to use JDO to update and delete database objects.
Step 3 demonstrates how to retrieve objects from the database using
JDO extents and JDOQL queries.
Step 4 combines all these operations into a complete GUI application.
<p>
<div align='center'>
<img src='images/jdo-dir-manager.gif' width='561' height='308'
       alt='JDO Directory Swing/JFC Application Screenshot'>
</div>

<h2>Demo File Structure</h2>
<p>
The classes are organized in the <code>directory</code> package and its sub packages.
Package <b>directory.pc</b> contains the four persistence capable classes
implementing the JDO Directory domain object model, as well as a <b>package.jdo</b> XML file that defines these classes as persistence capable.
Persistence capable classes in JDO replace tables in RDBMS and JDBC.
Instances of these persistence capable classes replace RDBMS's records.  
The items in the directory database are represented by <b>Item</b> and
<b>Book</b>, and the categories are represented by <b>Category</b>.
All these classes are sub classes of the <b>Element</b> abstract class.
Each Category instance keeps an <code>ArrayList</code> containing references to its sub categories and items.
In addition, every element keeps a reverse reference to its parent category.

<br><br>
<div align='center'>
<table border='1' cellpadding='0' cellspacing='0' width='90%'><tr><td>
    <table width='100%'><tr>
        <td align='center'>
            <img src='images/jdo-dir-files.gif' width='208' height='468'
                   alt='JDO Directory Files'>
        </td>
        <td align='center'>
            <img src='images/jdo-dir-uml.gif' width='296' height='427'
                   alt='JDO Directory UML Diagram'>
        </td>
    </tr><tr>
        <td align='center'>JDO Directory Demo - Files</td>
        <td align='center'>JDO Directory Demo - UML Diagram</td>
    </tr></table>
</td></tr></table>
</div>

<p>
Each demo step has its own package, containing two java files.
The <b>eMain</b> class is a program entry point, demonstrating "on the fly"
JDO enhancement.
First it enhances persistence capable classes when necessary, and then it
invokes the other class in the package, containing the "real" code.
This technique is very useful at development time as a replacement to the
traditional JDO enhancement (no need to use IDE plugins or tools like ANT,
project can be built just normally).
Common code shared by all the steps is included in the <code>directory.Utilities</code> class. 

<h2>Running the Demo (using Embedded Database Mode)</h2>
<p>
You can run the JDO Directory demo with any ObjectDB for Java/JDO edition.
If you haven't done so yet, you can download now the 
<a target="_blank" href="http://www.objectdb.com/database/jdo/free-download/">Free Database Edition</a>
which also includes this demo.
Use the following links for instructions on running the JDO Directory demo in
your Java environment:

<p><b>Java 2 SDK Instructions</b>
<br><a href='j2sdk-win/index.html'>Java 2 SDK for Windows</a>
<br><a href='j2sdk-unix/index.html'>Java 2 SDK for Unix</a>

<p><b>IDE Instructions</b>
<br><a href='jbuilder/index.html'>Borland JBuilder</a>
<br><a href='eclipse/index.html'>IBM Eclipse</a>
<br><a href='netbeans/index.html'>NetBeans / Forte / Sun One Studio</a>
<br><a href='jcreator/index.html'>JCreator</a>

<h2>Running the Demo in Client-Server Mode</h2>
<p>
By default, the demo runs in embedded mode, and the database file is accessed directly by the application (no database server is required to be running in the background). The server database edition supports also client server mode. Using the server edition, you can run the demo in client server mode, by editing the <b>properties.jdo</b> file in the <b>directory</b> directory, to use a remote url connection instead of a local url connection (see instructions in that file). An ObjectDB Server can be started, for instance, by the <b>[Tools => Start Database Server]</b> command in the Explorer. After the server is started, you can use the <b>Thread</b> card to watch or to stop its thread:

<p>
<div align='center'>
<img src='images/jdo-dir-server2.gif' width='412' height='387'
       alt='JDO Directory Swing/JFC Application Screenshot'>
</div>

<p>
Consult the developer's guide for more details on using ObjectDB in client-server mode.

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<p><hr><font size='-1'>Copyright (C) 2001-2005 by ObjectDB Software. All rights reserved.</font>

</td></tr></table></div></body>
</html>
